package com.yeqing.iodemo;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Buffer2Demo {


    public static void 使用基本的流读取数据一次读取8M个的字节数组() throws IOException {
        long start = System.currentTimeMillis();
        FileInputStream fis1 = new FileInputStream("/Users/cyq/Downloads/WeChatMac.dmg");
        FileOutputStream fos1 = new FileOutputStream("/Users/cyq/Downloads/WeChatMacCopy1.dmg");

        int len;
        byte[] data = new byte[1024 * 1024 * 8];
        while ((len = fis1.read(data)) != -1) {
            fos1.write(data, 0, len);
        }
        System.out.println("使用基本的流读取数据耗时：" + (System.currentTimeMillis() - start));
        fis1.close();
        fos1.close();
    }

    public static void main(String[] args) throws IOException {
        使用基本的流读取数据一次读取8M个的字节数组();
    }
}
